from django.db import models

# Create your models here.

class Admin(models.Model):
    name = models.CharField(max_length=32, verbose_name='用户名')
    password = models.CharField(max_length=64, verbose_name='密码')
    class Meta:
        db_table = 'django01_admin'
class Book(models.Model):
    title = models.CharField(max_length=100)
    author = models.CharField(max_length=100)
    pub_date = models.DateTimeField()
    class Meta:
        db_table = 'django01_book'

class Author(models.Model):
    name = models.CharField(max_length=100)
    email = models.EmailField()
    class Meta:
        db_table = 'django01_author'

class Books(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ForeignKey(Author, on_delete=models.CASCADE)
    class Meta:
        db_table = 'django01_books'

class Post(models.Model):
    title = models.CharField(max_length=200)
    content = models.TextField()
    author = models.ForeignKey(Author, on_delete=models.CASCADE)
    created_at = models.DateTimeField(auto_now_add=True)
    tags = models.ManyToManyField('Tags')
    class Meta:
        db_table = 'django01_post'

class Tags(models.Model):
    name = models.CharField(max_length=50)
    class Meta:
        db_table = 'django01_tags'